package aad.storyboard.model;

import utils.ViewUtils;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.ColorMatrix;
import android.graphics.Bitmap.Config;

public class RedFader implements Fader{

	Bitmap fadeBitmap;
	
	public RedFader(Bitmap btm)
	{
		fadeBitmap = btm; 
    	
	}
	
	@Override
	public void fade(ColorMatrix cm, int contrast) {
		fadeBitmap.eraseColor(Color.RED);  
		setRedAlpha(cm, contrast);
		
	}

	 private  void setRedAlpha(ColorMatrix cm, int contrast) {
  		 float scale = contrast - 1.f; 
         	 cm.set(new float[] {
                  255, 0, 0, 0, 0, 
                  0,  0, 0, 0, 0,
                  0, 0, 0, 0, 0, 
                  0, 0, 0, 0, scale});
    }
    
}
